<%@ page import="com.blog.domain.Favorites" %>
<%@ page import="java.util.List" %>
<%@ page import="com.google.common.collect.Lists" %>
<%@ page import="com.blog.search.UpdateIndexService" %>
<%@ page import="java.io.IOException" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    out.clear();
    out.flush();
    List<Favorites> fs = Lists.newArrayList();
    fs = (List<Favorites>)(new Favorites().getsByWhere(null));
    for( Favorites f : fs ){
        try{
            UpdateIndexService.update(f);
            out.write(String.format("[info]success in reindex,url is %s<br/>",f.getFlink()));
            out.flush();
        }catch (Exception e){
            e.printStackTrace();
            out.write(String.format("[warn]error in reindex,url is %s<br/>",f.getFlink()));
            out.flush();
        }
    }
    out.write("all success!");
    out.flush();
%>